| Conditions | 1 |
| Total Lines | 322 |
| Code Lines | 123 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | /* |
||
| 38 | constructor() { |
||
| 39 | super(); |
||
| 40 | // Include 'RF64' as a supported container format |
||
| 41 | this.supported_containers.push("RF64"); |
||
| 42 | /** |
||
| 43 | * The data of the 'fmt' chunk. |
||
| 44 | * @type {!Object<string, *>} |
||
| 45 | */ |
||
| 46 | this.fmt = { |
||
| 47 | /** @type {string} */ |
||
| 48 | chunkId: "", |
||
| 49 | /** @type {number} */ |
||
| 50 | chunkSize: 0, |
||
| 51 | /** @type {number} */ |
||
| 52 | audioFormat: 0, |
||
| 53 | /** @type {number} */ |
||
| 54 | numChannels: 0, |
||
| 55 | /** @type {number} */ |
||
| 56 | sampleRate: 0, |
||
| 57 | /** @type {number} */ |
||
| 58 | byteRate: 0, |
||
| 59 | /** @type {number} */ |
||
| 60 | blockAlign: 0, |
||
| 61 | /** @type {number} */ |
||
| 62 | bitsPerSample: 0, |
||
| 63 | /** @type {number} */ |
||
| 64 | cbSize: 0, |
||
| 65 | /** @type {number} */ |
||
| 66 | validBitsPerSample: 0, |
||
| 67 | /** @type {number} */ |
||
| 68 | dwChannelMask: 0, |
||
| 69 | /** |
||
| 70 | * 4 32-bit values representing a 128-bit ID |
||
| 71 | * @type {!Array<number>} |
||
| 72 | */ |
||
| 73 | subformat: [], |
||
| 74 | /** |
||
| 75 | * MPEG additional format information |
||
| 76 | * when audioFormat == 80 |
||
| 77 | * https://tech.ebu.ch/docs/tech/tech3285s1.pdf |
||
| 78 | */ |
||
| 79 | /** @type {number} */ |
||
| 80 | headLayer: 0, |
||
| 81 | /** @type {number} */ |
||
| 82 | headBitRate: 0, |
||
| 83 | /** @type {number} */ |
||
| 84 | headMode: 0, |
||
| 85 | /** @type {number} */ |
||
| 86 | headModeExt: 0, |
||
| 87 | /** @type {number} */ |
||
| 88 | headEmphasis: 0, |
||
| 89 | /** @type {number} */ |
||
| 90 | headFlags: 0, |
||
| 91 | /** @type {number} */ |
||
| 92 | ptsLow: 0, |
||
| 93 | /** @type {number} */ |
||
| 94 | ptsHigh: 0 |
||
| 95 | }; |
||
| 96 | /** |
||
| 97 | * The data of the 'fact' chunk. |
||
| 98 | * @type {!Object<string, *>} |
||
| 99 | */ |
||
| 100 | this.fact = { |
||
| 101 | /** @type {string} */ |
||
| 102 | chunkId: "", |
||
| 103 | /** @type {number} */ |
||
| 104 | chunkSize: 0, |
||
| 105 | /** @type {number} */ |
||
| 106 | dwSampleLength: 0 |
||
| 107 | }; |
||
| 108 | /** |
||
| 109 | * The data of the 'cue ' chunk. |
||
| 110 | * @type {!Object<string, *>} |
||
| 111 | */ |
||
| 112 | this.cue = { |
||
| 113 | /** @type {string} */ |
||
| 114 | chunkId: "", |
||
| 115 | /** @type {number} */ |
||
| 116 | chunkSize: 0, |
||
| 117 | /** @type {number} */ |
||
| 118 | dwCuePoints: 0, |
||
| 119 | /** @type {!Array<!Object>} */ |
||
| 120 | points: [] |
||
| 121 | }; |
||
| 122 | /** |
||
| 123 | * The data of the 'smpl' chunk. |
||
| 124 | * @type {!Object<string, *>} |
||
| 125 | */ |
||
| 126 | this.smpl = { |
||
| 127 | /** @type {string} */ |
||
| 128 | chunkId: "", |
||
| 129 | /** @type {number} */ |
||
| 130 | chunkSize: 0, |
||
| 131 | /** @type {number} */ |
||
| 132 | dwManufacturer: 0, |
||
| 133 | /** @type {number} */ |
||
| 134 | dwProduct: 0, |
||
| 135 | /** @type {number} */ |
||
| 136 | dwSamplePeriod: 0, |
||
| 137 | /** @type {number} */ |
||
| 138 | dwMIDIUnityNote: 0, |
||
| 139 | /** @type {number} */ |
||
| 140 | dwMIDIPitchFraction: 0, |
||
| 141 | /** @type {number} */ |
||
| 142 | dwSMPTEFormat: 0, |
||
| 143 | /** @type {number} */ |
||
| 144 | dwSMPTEOffset: 0, |
||
| 145 | /** @type {number} */ |
||
| 146 | dwNumSampleLoops: 0, |
||
| 147 | /** @type {number} */ |
||
| 148 | dwSamplerData: 0, |
||
| 149 | /** @type {!Array<!Object>} */ |
||
| 150 | loops: [] |
||
| 151 | }; |
||
| 152 | /** |
||
| 153 | * The data of the 'bext' chunk. |
||
| 154 | * @type {!Object<string, *>} |
||
| 155 | */ |
||
| 156 | this.bext = { |
||
| 157 | /** @type {string} */ |
||
| 158 | chunkId: "", |
||
| 159 | /** @type {number} */ |
||
| 160 | chunkSize: 0, |
||
| 161 | /** @type {string} */ |
||
| 162 | description: "", //256 |
||
| 163 | /** @type {string} */ |
||
| 164 | originator: "", //32 |
||
| 165 | /** @type {string} */ |
||
| 166 | originatorReference: "", //32 |
||
| 167 | /** @type {string} */ |
||
| 168 | originationDate: "", //10 |
||
| 169 | /** @type {string} */ |
||
| 170 | originationTime: "", //8 |
||
| 171 | /** |
||
| 172 | * 2 32-bit values, timeReference high and low |
||
| 173 | * @type {!Array<number>} |
||
| 174 | */ |
||
| 175 | timeReference: [0, 0], |
||
| 176 | /** @type {number} */ |
||
| 177 | version: 0, //WORD |
||
| 178 | /** @type {string} */ |
||
| 179 | UMID: "", // 64 chars |
||
| 180 | /** @type {number} */ |
||
| 181 | loudnessValue: 0, //WORD |
||
| 182 | /** @type {number} */ |
||
| 183 | loudnessRange: 0, //WORD |
||
| 184 | /** @type {number} */ |
||
| 185 | maxTruePeakLevel: 0, //WORD |
||
| 186 | /** @type {number} */ |
||
| 187 | maxMomentaryLoudness: 0, //WORD |
||
| 188 | /** @type {number} */ |
||
| 189 | maxShortTermLoudness: 0, //WORD |
||
| 190 | /** @type {string} */ |
||
| 191 | reserved: "", //180 |
||
| 192 | /** @type {string} */ |
||
| 193 | codingHistory: "" // string, unlimited |
||
| 194 | }; |
||
| 195 | /** |
||
| 196 | * The data of the 'mext' chunk. |
||
| 197 | * @type {!Object<string, *>} |
||
| 198 | */ |
||
| 199 | this.mext = { |
||
| 200 | /** @type {string} */ |
||
| 201 | chunkId: "", |
||
| 202 | /** @type {number} */ |
||
| 203 | chunkSize: 0, |
||
| 204 | /** @type {number} */ |
||
| 205 | soundInformation: 0, |
||
| 206 | /** @type {number} */ |
||
| 207 | frameSize: 0, |
||
| 208 | /** @type {number} */ |
||
| 209 | ancillaryDataLength: 0, |
||
| 210 | /** @type {number} */ |
||
| 211 | ancillaryDataDef: 0, //4 |
||
| 212 | /** @type {string} */ |
||
| 213 | reserved: "" |
||
| 214 | }; |
||
| 215 | /** |
||
| 216 | * The cart of the cart chunk. |
||
| 217 | * @type {!Object<string, *>} |
||
| 218 | */ |
||
| 219 | this.cart = { |
||
| 220 | /** @type {string} */ |
||
| 221 | chunkId: "", |
||
| 222 | /** @type {number} */ |
||
| 223 | chunkSize: 0, |
||
| 224 | /** @type {string} */ |
||
| 225 | version: "", |
||
| 226 | /** @type {string} */ |
||
| 227 | title: "", |
||
| 228 | /** @type {string} */ |
||
| 229 | artist: "", |
||
| 230 | /** @type {string} */ |
||
| 231 | cutId: "", |
||
| 232 | /** @type {string} */ |
||
| 233 | clientId: "", |
||
| 234 | /** @type {string} */ |
||
| 235 | category: "", |
||
| 236 | /** @type {string} */ |
||
| 237 | classification: "", |
||
| 238 | /** @type {string} */ |
||
| 239 | outCue: "", |
||
| 240 | /** @type {string} */ |
||
| 241 | startDate: "", |
||
| 242 | /** @type {string} */ |
||
| 243 | startTime: "", |
||
| 244 | /** @type {string} */ |
||
| 245 | endDate: "", |
||
| 246 | /** @type {string} */ |
||
| 247 | endTime: "", |
||
| 248 | /** @type {string} */ |
||
| 249 | producerAppId: "", |
||
| 250 | /** @type {string} */ |
||
| 251 | producerAppVersion: "", |
||
| 252 | /** @type {string} */ |
||
| 253 | userDef: "", |
||
| 254 | /** @type {number} */ |
||
| 255 | levelReference: 0, |
||
| 256 | /** @type {!Array<!Object>} */ |
||
| 257 | postTimer: [], |
||
| 258 | /** @type {string} */ |
||
| 259 | reserved: "", |
||
| 260 | /** @type {string} */ |
||
| 261 | url: "", |
||
| 262 | /** @type {string} */ |
||
| 263 | tagText: "" |
||
| 264 | }; |
||
| 265 | /** |
||
| 266 | * The data of the 'iXML' chunk. |
||
| 267 | * @type {!Object<string, *>} |
||
| 268 | */ |
||
| 269 | this.iXML = { |
||
| 270 | /** @type {string} */ |
||
| 271 | chunkId: "", |
||
| 272 | /** @type {number} */ |
||
| 273 | chunkSize: 0, |
||
| 274 | /** @type {string} */ |
||
| 275 | value: "" |
||
| 276 | }; |
||
| 277 | /** |
||
| 278 | * The data of the 'ds64' chunk. |
||
| 279 | * Used only with RF64 files. |
||
| 280 | * @type {!Object<string, *>} |
||
| 281 | */ |
||
| 282 | this.ds64 = { |
||
| 283 | /** @type {string} */ |
||
| 284 | chunkId: "", |
||
| 285 | /** @type {number} */ |
||
| 286 | chunkSize: 0, |
||
| 287 | /** @type {number} */ |
||
| 288 | riffSizeHigh: 0, // DWORD |
||
| 289 | /** @type {number} */ |
||
| 290 | riffSizeLow: 0, // DWORD |
||
| 291 | /** @type {number} */ |
||
| 292 | dataSizeHigh: 0, // DWORD |
||
| 293 | /** @type {number} */ |
||
| 294 | dataSizeLow: 0, // DWORD |
||
| 295 | /** @type {number} */ |
||
| 296 | originationTime: 0, // DWORD |
||
| 297 | /** @type {number} */ |
||
| 298 | sampleCountHigh: 0, // DWORD |
||
| 299 | /** @type {number} */ |
||
| 300 | sampleCountLow: 0 // DWORD |
||
| 301 | /** @type {number} */ |
||
| 302 | //'tableLength': 0, // DWORD |
||
| 303 | /** @type {!Array<number>} */ |
||
| 304 | //'table': [] |
||
| 305 | }; |
||
| 306 | /** |
||
| 307 | * The data of the 'data' chunk. |
||
| 308 | * @type {!Object<string, *>} |
||
| 309 | */ |
||
| 310 | this.data = { |
||
| 311 | /** @type {string} */ |
||
| 312 | chunkId: "", |
||
| 313 | /** @type {number} */ |
||
| 314 | chunkSize: 0, |
||
| 315 | /** @type {!Uint8Array} */ |
||
| 316 | samples: new Uint8Array(0) |
||
| 317 | }; |
||
| 318 | /** |
||
| 319 | * The data of the 'LIST' chunks. |
||
| 320 | * Each item in this list look like this: |
||
| 321 | * { |
||
| 322 | * chunkId: '', |
||
| 323 | * chunkSize: 0, |
||
| 324 | * format: '', |
||
| 325 | * subChunks: [] |
||
| 326 | * } |
||
| 327 | * @type {!Array<!Object>} |
||
| 328 | */ |
||
| 329 | this.LIST = []; |
||
| 330 | /** |
||
| 331 | * The data of the 'junk' chunk. |
||
| 332 | * @type {!Object<string, *>} |
||
| 333 | */ |
||
| 334 | this.junk = { |
||
| 335 | /** @type {string} */ |
||
| 336 | chunkId: "", |
||
| 337 | /** @type {number} */ |
||
| 338 | chunkSize: 0, |
||
| 339 | /** @type {!Array<number>} */ |
||
| 340 | chunkData: [] |
||
| 341 | }; |
||
| 342 | /** |
||
| 343 | * The data of the '_PMX' chunk. |
||
| 344 | * @type {!Object<string, *>} |
||
| 345 | */ |
||
| 346 | this._PMX = { |
||
| 347 | /** @type {string} */ |
||
| 348 | chunkId: "", |
||
| 349 | /** @type {number} */ |
||
| 350 | chunkSize: 0, |
||
| 351 | /** @type {string} */ |
||
| 352 | value: "" |
||
| 353 | }; |
||
| 354 | /** |
||
| 355 | * @type {{be: boolean, bits: number, fp: boolean, signed: boolean}} |
||
| 356 | * @protected |
||
| 357 | */ |
||
| 358 | this.uInt16 = { bits: 16, be: false, signed: false, fp: false }; |
||
| 359 | } |
||
| 360 | |||
| 882 |